<?php
include "../lib/DAL/ChiTietLopMon.php";

class ChiTietLopMonBLL{
    function __construct(){
    }
    
    function __destruct(){
    }
    
    
    public function SetChiTietLopMonBLL($row){
        $ctdt=new ChiTietLopMon();
        $ctdt->setChiTietLopMon($row['ghichu_ctlm'],$row['ma_cbgv'],$row['ma_chitiet_lopmon'],$row['ma_lopmon'],$row['ma_phong'],
                                $row['madm_ca'],$row['madm_ttctlm'],$row['ngayhoc_ctlm'],$row['nguoicapnhatcuoi'],$row['thoigian_capnhat']);
    
        return $ctdt;
    }
    public function Getngaythi_lopmon($lopmon)
    {
        $sql="SELECT * FROM tbl_chitiet_lopmon WHERE ma_lopmon IN ($lopmon)";
        $ds=null; 
        $ex=mysql_query($sql);
        if($ex){
            while($row=mysql_fetch_array($ex)){
                $ds[]=$this->SetChiTietLopMonBLL($row);                
            }
        }
        return $ds;
    }
    
        
    public function Insert_ChiTietLopMon($ctlm)
    {
        $sql="INSERT INTO tbl_chitiet_lopmon(ma_chitiet_lopmon, ma_lopmon, madm_ca, ngayhoc_ctlm, ma_cbgv, ghichu_ctlm, 
                                            nguoicapnhatcuoi, thoigian_capnhat, madm_ttctlm, ma_phong) 
                                    VALUES ('".$ctlm->getma_chitiet_lopmon()."','".$ctlm->getma_lopmon()."','".$ctlm->getmadm_ca()."',
                                            '".$ctlm->getngayhoc_ctlm()."','".$ctlm->getma_cbgv()."','".$ctlm->getghichu_ctlm()."',
                                            '".$ctlm->getnguoicapnhatcuoi()."','".$ctlm->getthoigian_capnhat()."',
                                            '".$ctlm->getmadm_ttctlm()."','".$ctlm->getma_phong()."')";
        
        $ex=mysql_query($sql);
        
        return $ex;
    }
    
}
?>